import React, {Component} from 'react';
import {Text} from 'react-native';
import Style from 'M/UI/Style';

export default class TextComponent extends Component {
  constructor(prop) {
    super(prop);
    this.state = {
      style: {},
      color: Style.theme.colors.text,
    };
  }

  componentDidMount() {
    Style.setThemeColorChange(this, {color: 'text'});
  }

  render() {
    const {children, style, ...rest} = this.props;
    const {color} = this.state;
    return (
      <Text {...rest} style={[{color}, style]}>
        {children}
      </Text>
    );
  }
}
